package com.servlet;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet(name = "ToShoppingServlet", value = "/ToShoppingServlet")
public class ToShoppingServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        int uid = Integer.parseInt(request.getParameter("userid"));
        request.setAttribute("userId",uid);
        System.out.println("商品页面跳转到购物车页面的用户ID："+uid);
        //response.setHeader("REQUEST_AUTH","1");

        request.getRequestDispatcher("JSP/Shopping.jsp").forward(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    doGet(request,response);
    }
}
